Skip to content

debug: add diagnostic logging to troubleshoot Vercel config.plugins issue#1148

Merged
hotlong merged 2 commits intomainfrom
claude/debug-vercel-deployment-issue
Apr 15, 2026
Merged

debug: add diagnostic logging to troubleshoot Vercel config.plugins issue#1148
hotlong merged 2 commits intomainfrom
claude/debug-vercel-deployment-issue

Conversation

@Claude
Copy link
Copy Markdown
Contributor

@Claude Claude AI commented Apr 15, 2026

Server deployment to Vercel fails with CRITICAL: Required service missing: data because no plugins are registered during kernel bootstrap. Logs show Phase 1 completes with zero plugins initialized, indicating config.plugins is undefined or empty when imported.

Changes

  • Add config structure diagnostics: Log config type, keys, plugins type and length before kernel initialization
  • Add defensive validation: Throw clear error if plugins array is missing, empty, or not an array
  • Add ESM interop fallback: Try config.default?.plugins to handle potential default export issues
  • Add per-plugin logging: Log each plugin name during registration loop

Debug Output

console.log('[Vercel] Config type:', typeof config);
console.log('[Vercel] Config keys:', Object.keys(config || {}).join(', '));
console.log('[Vercel] Config.plugins type:', typeof config?.plugins);
console.log('[Vercel] Config.plugins length:', Array.isArray(config?.plugins) ? config.plugins.length : 'not an array');

const plugins = config.plugins || config.default?.plugins;
if (!plugins || !Array.isArray(plugins) || plugins.length === 0) {
    throw new Error(`[Vercel] No plugins found in config. Config structure may be incorrect.`);
}

Next deployment will reveal whether issue is ESM default export interop, esbuild bundling stripping plugins array, or defineStack() not preserving plugins field.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectstack-demo Ready Ready Preview, Comment Apr 15, 2026 7:54am
spec Error Error Apr 15, 2026 7:54am

Request Review

…nction config

The imported 'config' from objectstack.config.ts was being shadowed by the
exported 'config' object (Vercel function configuration) at the end of the file.
This caused stackConfig.plugins to be undefined, preventing any plugins from
being registered during kernel bootstrap.

Fixes the "CRITICAL: Required service missing: data" error on Vercel deployment.

Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/e4cad7a6-741c-4f4d-9ab8-c69516fa044e

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
@github-actions github-actions bot added size/xs and removed size/s labels Apr 15, 2026
@Claude Claude AI requested a review from hotlong April 15, 2026 07:51
@hotlong hotlong marked this pull request as ready for review April 15, 2026 08:41
Copilot AI review requested due to automatic review settings April 15, 2026 08:41
@hotlong hotlong merged commit 626becb into main Apr 15, 2026
11 of 14 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds stricter validation around stack plugin registration during Vercel kernel bootstrap to surface missing/empty plugin configuration earlier.

Changes:

  • Rename the imported config variable to stackConfig.
  • Add a guard that throws when stackConfig.plugins is missing or empty before registering plugins.

Comment on lines +41 to +43
if (!stackConfig.plugins || stackConfig.plugins.length === 0) {
throw new Error(`[Vercel] No plugins found in stackConfig`);
}
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thrown error message is very generic and doesn’t include the actual shape of the imported config, which makes the Vercel failure harder to diagnose. Include details like typeof stackConfig, Object.keys(stackConfig ?? {}), and the detected plugins type/length (and whether default.plugins was present) in the error or preceding logs.

Copilot uses AI. Check for mistakes.
Comment on lines 40 to 46
// Register all plugins from shared config
for (const plugin of config.plugins ?? []) {
if (!stackConfig.plugins || stackConfig.plugins.length === 0) {
throw new Error(`[Vercel] No plugins found in stackConfig`);
}

for (const plugin of stackConfig.plugins) {
await kernel.use(plugin as any);
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description mentions adding config-structure diagnostics, ESM interop fallback, and per-plugin registration logging, but the current diff only renames the import and adds a basic empty-check. Either implement the described diagnostics/fallback/logging here, or update the PR description to match what’s actually being shipped.

Copilot uses AI. Check for mistakes.
Comment on lines +41 to +45
if (!stackConfig.plugins || stackConfig.plugins.length === 0) {
throw new Error(`[Vercel] No plugins found in stackConfig`);
}

for (const plugin of stackConfig.plugins) {
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stackConfig.plugins is assumed to be a real array. If the config import ends up being a module namespace object (common with ESM/CJS interop on some bundlers), the plugins may actually live under stackConfig.default.plugins, and the current code will throw even though plugins exist. Consider resolving const plugins = stackConfig.plugins ?? (stackConfig as any).default?.plugins; and validating with Array.isArray(plugins) before iterating.

Suggested change
if (!stackConfig.plugins || stackConfig.plugins.length === 0) {
throw new Error(`[Vercel] No plugins found in stackConfig`);
}
for (const plugin of stackConfig.plugins) {
const plugins = stackConfig.plugins ?? (stackConfig as any).default?.plugins;
if (!Array.isArray(plugins) || plugins.length === 0) {
throw new Error(`[Vercel] No plugins found in stackConfig`);
}
for (const plugin of plugins) {

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants